﻿using System.Collections.Generic;
using System.Text;
using WinnerCMS.BLL;
using WinnerCMS.BLL.PageFactory;
using WinnerCMS.Common;
using WinnerCMS.Model;

namespace WinnerCMS.WebFactory
{
    public static class CategoryCommon
    {
        #region 导航栏
        /// <summary>
        /// 导航栏
        /// </summary>
        /// <param name="tempStrBuilder"></param>
        /// <param name="categoryId"></param>
        static public void Path(StringBuilder tempStrBuilder, int categoryId)
        {
            IList<Category> list = new CategoryManage().GetFatherAndMe(categoryId);
            StringBuilder classPath = new StringBuilder();
            classPath.Append("<a href=\"");
            classPath.Append(StaticFilePath.IndexUrl());
            classPath.Append("\">");
            classPath.Append(WebConfig.SiteName);
            classPath.Append("</a>");

            foreach (Category model in list)
            {
                classPath.AppendFormat(" → <a href=\"{0}\">", model.Link);
                classPath.Append(model.CategoryName);
                classPath.Append("</a>");
            }

            tempStrBuilder.Replace("[Path]", classPath.ToString());
        }
        #endregion

    }
}